﻿using Basic.HrGatewayModular.Interface;
using Basic.HrGatewayModular.Model.Msg;
using Basic.HrRemoteModel.Msg.Model;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.HrGatewayModular.Api
{
    internal class MsgApi : ApiController
    {
        private readonly IMsgService _Service;

        public MsgApi ( IMsgService service )
        {
            this._Service = service;
        }

        public PagingResult<MsgDatum> Query ( PagingParam<MsgQueryUI> query )
        {
            return this._Service.Query(query, base.UserState.ToEmpId());
        }
        public Dictionary<string, int> GetUserMsgTotal ( MsgGetUI arg )
        {
            return this._Service.GetTotal(arg, base.UserState.ToEmpId());
        }
        public void SetRead ( [NumValidate("hr.msg.id.error", 1)] long id )
        {
            this._Service.SetAlreadyRead(id);
        }

        public void BatchSetRead ( [NullValidate("hr.msg.id.null")] long[] ids )
        {
            this._Service.SetAlreadyRead(ids);
        }

    }
}
